package constant;

import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import freemarker.template.Configuration;

public class FreeMarkerConfig {

	public static Configuration configuration = new Configuration();

	static {
		try {
			String ftlPath = Constant.modelFiles;
			ftlPath = URLDecoder.decode(ftlPath, "utf-8");
			File file = new File(ftlPath);
			
			if (!file.exists()) {
				file.mkdir();
			}

			configuration.setDirectoryForTemplateLoading(file);
			configuration.setDefaultEncoding("UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
